package Top200;

import common.TreeNode;

/**
 * @author zhangmin
 * @create 2022-02-27 17:25
 */
public class isSameTree100 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (p==null) return q==null;
        if (q==null) return p==null;
        if (p.val!=q.val) return false;
        return isSameTree(p.left,q.left)&&isSameTree(p.right,q.right);
    }
}
